﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtomPuzzleSolver.Model
{
    public class CircularList<T> : Queue<T>
    {
        public int MaxLength { get; set; }

        public CircularList(int maxLength)
        {
            MaxLength = maxLength;
        }

        public void Add(T item)
        {
            if (this.Count < MaxLength)
            {
                this.Enqueue(item);
            }
            else
            {
                this.Dequeue();
                this.Enqueue(item);
            }
        }
    }
}
